<template>
  <div class="choosetoplay">
    <xinyun28 v-if="lottery_type == 1 || lottery_type == 3 ||lottery_type==17||lottery_type==18||lottery_type==20||lottery_type == 22" :oddsData="oddsData" :lDragonData="lDragonData" :BetmoneyList="BetmoneyList" :timeMessages="timeMessages" :cRoomData="cRoomData" :bindAbsClass="bindAbsClass"></xinyun28>
    <pk10 v-else-if="lottery_type == 2 || lottery_type == 4 || lottery_type == 9 || lottery_type == 14" :lDragonData="lDragonData" :BetmoneyList="BetmoneyList" :oddsData="oddsData" :timeMessages="timeMessages" :cRoomData="cRoomData" :bindAbsClass="bindAbsClass"></pk10>
    <cqssc v-else-if="lottery_type == 5 || lottery_type == 6 || lottery_type == 11||lottery_type == 21" :lDragonData="lDragonData" :oddsData="oddsData" :BetmoneyList="BetmoneyList" :timeMessages="timeMessages" :cRoomData="cRoomData" :bindAbsClass="bindAbsClass"></cqssc>
    <lhc v-else-if="lottery_type == 7 || lottery_type == 8" :lDragonData="lDragonData" :oddsData="oddsData" :BetmoneyList="BetmoneyList" :timeMessages="timeMessages" :cRoomData="cRoomData" :bindAbsClass="bindAbsClass"></lhc>
    <niuniu v-else-if="lottery_type == 10" :lDragonData="lDragonData" :oddsData="oddsData" :BetmoneyList="BetmoneyList" :timeMessages="timeMessages" :cRoomData="cRoomData" :bindAbsClass="bindAbsClass"></niuniu>
    <shaiBao v-else-if="lottery_type == 13" :lDragonData="lDragonData" :oddsData="oddsData" :BetmoneyList="BetmoneyList" :timeMessages="timeMessages" :cRoomData="cRoomData" :bindAbsClass="bindAbsClass"></shaiBao>
    <kuaiSan :lDragonData="lDragonData" :oddsData="oddsData" :BetmoneyList="BetmoneyList" :timeMessages="timeMessages" :cRoomData="cRoomData" :bindAbsClass="bindAbsClass" v-else-if="lottery_type == 19"></kuaiSan>
    <askRoad v-if="showAskRoad"></askRoad>
  </div>
</template>

<script>
    import xinyun28 from "./xinyun28/xinyun28";
    import pk10 from "./beiJingPK10/pk10";
    import cqssc from "./chongQingSSC/chongqingssc";
    import lhc from "./lhc/lhc";
    import niuniu from "./niuniu/niuniu";
    import askRoad from "./askRoad/askRoad";
    import shaiBao from "./shaiBao/shaiBao";
    import kuaiSan from "./kuaiSan/kuaiSan";
    import { mapGetters, mapActions } from "vuex";    
    import {fetchJson} from "@/common/js/request";
    
    import _ from "lodash";
    export default {
      props:['timeMessages','cRoomData','BetmoneyList','bindAbsClass',"newLotResult"],
            data() {
                return {
                  oddsData:{},
                  lottery_type:null,
                  lDragonData: [],
                }
            },
            created() {
              this.lottery_type = this.$route.query.lottery_type
            },
            mounted() {
              this.getBtRatio()
            },
            computed: {
              ...mapGetters(["showAskRoad"])
            },
            methods: {
              getBtRatio:function(){
                  let result = fetchJson(this,"?m=api&c=odds&a=getOdds",{room_id:this.$route.query.id}).then(result=>{
                    if(_.isEmpty(result)){
                      //无数据
                      return;
                    }
                    this.oddsData = result.data;
                    this.getLRatio()
                  });
                
              },
              getLRatio: function(){
                fetchJson(this,"?m=api&c=app&a=getLongDragonOdds",{lottery_type: this.$route.query.lottery_type,room_id:this.$route.query.id}).then(result=>{
                  if(_.isEmpty(result)){
                    //无数据
                    return;
                  }
                  //this.lDragonData = result.data
                })
              }
            },
            components: {xinyun28:xinyun28,pk10:pk10,cqssc:cqssc,lhc:lhc,niuniu:niuniu,askRoad:askRoad,shaiBao:shaiBao,kuaiSan:kuaiSan},
            watch: {
              showAskRoad: function(newVal,oldVal){
                if(newVal){
                  setTimeout(function(){
                    var chatcontent = document.getElementById('chatcontent')                
                    var askRoadPanel = document.getElementById('askRoadPanel')
                    // askRoadPanel.style.width=chatcontent.offsetWidth+'px'
                    askRoadPanel.style.right=-chatcontent.offsetWidth+'px'
                  })
                }
              },
              newLotResult: function(newVal){
                if(newVal){
                  this.getLRatio()
                }
              }
            },
            deactivated() {
              
            },
            beforeDestroy() {

            }

        }
</script>

<style scoped>
.choosetoplay {
  position: relative;
  height: 760px;
  max-width: 820px;
}

</style>

<style>
</style>



// WEBPACK FOOTER //
// src/components/room/playMethods/playMethods.vue